<?php

class Default_IndexController extends Zend_Controller_Action
{
	public $config;
	public $auth;
	public $authAdapter;
	public $params;
	public $dbAdapter;
	public $fileAdapter;
	public $cache;
	public $cache_id;
	public $acl;
	public $logger;
	
    public function preDispatch()
    {
    	
    	$this->config				= Zend_Registry::get('Zend_Config_Ini');
		$this->cache				= Zend_Registry::get('Zend_Cache');
		$this->auth					= Zend_Auth::getInstance();
		$this->authAdapter			= Zend_Registry::get('Zend_Auth');
		$this->fileAdapter			= Zend_Registry::get('Zend_File');
		$this->acl 					= Zend_Registry::get('Zend_Acl');
		$this->logger 				= Zend_Registry::get('Zend_Log');
		$this->dbAdapter			= Zend_Db_Table::getDefaultAdapter();
		$this->params 				= $this->getRequest()->getParams();	
		$this->cache_id				= $this->params['module'].'_'.$this->params['controller'].'_'.$this->params['action'];
		$this->acl_id				= $this->params['module'].':'.$this->params['controller'].':'.$this->params['action'];
    	
        try
    	{
    		if(!@$this->acl->isAllowed($this->auth->getIdentity()->role, @$this->acl_id))
    		{
    		   $this->view->message		= 'Access denied';
    		   $this->view->cssstyle	= 'accessdenied'; 
    			
    		   self::getRequest()->setControllerName('error');
    		   self::getRequest()->setActionName('error');
    		}
    	}
    	catch (Zend_Exception $e) {}
    }

    public function indexAction()
    {
        // action body
    }

    public function accessAction()
    {
    	
    }
}

